<?
$table = $table_Prefix."plate";
$sqlstr="select display_swith from ".$table."  where mid = '".$system_part."' limit 1 ";
$result = mysql_query($sqlstr);
$display_swith_info = mysql_fetch_assoc($result);
mysql_close($con);
$display_swith_arr =[];
$display_swith_str = "";//把需要隐藏的calss 动态拼接 格式为: form li.name,li.detail...
if(!empty($display_swith_info['display_swith'])){
    $display_swith_arr = explode(",",$display_swith_info['display_swith']);
    foreach ($display_swith_arr as $dvalue)
    {
        $display_swith_str = $display_swith_str.",li.".$dvalue."";
    }
    $display_swith_str = "form ".substr($display_swith_str,1);
    echo "<style text='text/css'> $display_swith_str{display: none} </style>";
}

?>
<style type="text/css">
    .backstage_edit_div{
        width: 150px;height: 50px;position: fixed;left: 0px;top: 0px;z-index: 999;display: none;
    }
   .backstage_edit_div button{
       background-color: #008CBA;
       border: none;
       color: white;
       padding: 5px 10px;
       text-align: center;
       text-decoration: none;
       display: inline-block;
       font-size: 16px;
       margin: 4px 2px;
       cursor: pointer;
   }
</style>
<div class="backstage_edit_div">
    <button onclick="openBackstagePageEdit()" class="backstage_edit_div_btn">编辑</button>
    <button onclick="submit_Backstage_cssname()">确认</button>
</div>
<script>
    //set cookie在《网站设置》页面 E:\site2\evolution\controller\site\edit.php


    if($.cookie("administrator_mode")){
        $(".backstage_edit_div").show();
    }
        var display_swith_str = '<? echo $display_swith_str;  ?>';
        var licssClassList = eval('<?php echo json_encode($display_swith_arr);?>');

        var backstagePageEditSwith = true;
        function openBackstagePageEdit(){
            if(backstagePageEditSwith){
                backstagePageEditSwith = false;
            }else{
                alert("编辑已经开启，退出请刷新页面");
                return;
            }

            var oncolor = "rgb(255, 0, 0)";
            var offcolor = "rgb(0, 0, 0)";

            if(display_swith_str != ""){
                console.log(display_swith_str);
                $(display_swith_str).show();
                $(display_swith_str).css({"color" : oncolor});
            }

            $(".backstage_edit_div_btn").css({"color" : oncolor});

            $("form li").on("click", function(){
                var classname = $(this).attr("class").substr(16);

                if($(this).css("color") == offcolor){
                    $(this).css({ "color": oncolor});
                    licssClassList.push(classname);
                }else{
                    $(this).css({ "color": offcolor});
                    licssClassList.splice(licssClassList.indexOf(classname),1);
                }
                console.log(licssClassList);
            });
        }
        function submit_Backstage_cssname(){
            $.post("../pageedit/backstage_css_update_api.php", { "cssNameList" : licssClassList,"mid" : '<? echo $system_part?>'} ,function(data){
                if(data.message == 'success'){
                    window.location.reload();
                }
            },'json');
        }



</script>